package com.hxd.qzg.module._admin.login;

import org.apache.commons.lang3.StringUtils;

import com.hxd.qzg.common.BaseController;
import com.hxd.qzg.common.Result;
import com.hxd.qzg.common.model.Qz;
import com.jfinal.plugin.activerecord.Page;

import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;

public class QzController extends BaseController {

    private static final Log logger = LogFactory.get();


    /**
     * 显示登录界面
     */

	public void list() {
		String start = get("start");
		String end = get("end");
		String key = get("key");
		String fromSql = "FROM api_qz WHERE is_delete=0";

		if (StringUtils.isNotEmpty(key)) {
			fromSql = fromSql + " AND MATCH (request,name,account) AGAINST ('" + key + "')";
		}

		
		if (StringUtils.isNotEmpty(start)) {
			fromSql = fromSql + " AND last_date >= '" + start + "'";
		}
		if (StringUtils.isNotEmpty(end)) {
			fromSql = fromSql + " AND last_date <= '" + end + "'";
		}

		
		Page<Qz> page = Qz.dao.paginate(getInt("pageNum"), getInt("pageSize"), "select *", fromSql);

		renderJson(Result.success(page));
    }

}
